﻿@inherits BindEmailBase
<BCard EnableAlwaysRender="true" @ref="bCard">
    <Body>
        @if (value != null && !string.IsNullOrWhiteSpace(value.Email))
        {
        <BForm @ref="bForm" Value="value" LabelAlign="@LabelAlign.Right" Inline="true" EnableAlwaysRender="true">
            <BFormItem TValue="string" Label="" Name="@nameof(PasswordModel.Email)" IsRequired="false">
                <BButton Type="ButtonType.Info" IsPlain="true" Style="border:none" IsDisabled="true">@($"已绑定：{ value.Email}")</BButton>
            </BFormItem>
            @if (SendCanCelEmailBindCodeSuccess)
            {
                <BFormItem TValue="string" Label="验证码：" Name="@nameof(PasswordModel.Code)" IsRequired="false">
                    <BInput TValue="string" Placeholder="请输入验证码"></BInput>
                </BFormItem>
                <BFormActionItem EnableAlwaysRender="true" Style="text-align-last:right;">
                    <BButton Type="@ButtonType.Default" IsDisabled="BtnConfirmDisabled" IsPlain="true" OnClick="e => CanCelBindConfirm()" EnableAlwaysRender="true">
                        确定
                    </BButton>
                </BFormActionItem>
            }
            else
            {
                <BFormActionItem EnableAlwaysRender="true" Style="text-align-last:right;">
                    <BButton Type="@ButtonType.Info" IsDisabled="BtnCancelDisabled" IsPlain="true" OnClick="e => CanCelBind()" EnableAlwaysRender="true">
                        取消绑定
                    </BButton>
                </BFormActionItem>
            }

        </BForm>
        }
        else
        {
            <BForm @ref="bForm" Value="value" LabelAlign="@LabelAlign.Right" Inline="true" EnableAlwaysRender="true">
                <BFormItem TValue="string" Label="邮箱：" Name="@nameof(PasswordModel.Email)" IsRequired="true">
                    <BInput TValue="string" Type="InputType.Tel" Placeholder="请输入邮箱地址"></BInput>
                </BFormItem>
                <BFormActionItem EnableAlwaysRender="true" Style="text-align-last:right;">
                    <BButton Type="@ButtonType.Default" IsPlain="true" OnClick="e => SendEmailMsg()" EnableAlwaysRender="true" IsDisabled="BtnBindEmailDisabled">
                        @((TimeOut > 0 && TimeOut < CountDownTime)?$"请等待{TimeOut}s后重试":"绑定邮箱")
                    </BButton>
                </BFormActionItem>
                @if (showInput)
                {
                    <BFormItem TValue="string" Label="验证码：" Name="@nameof(PasswordModel.Code)" IsRequired="false">
                        <BInput TValue="string" Placeholder="请输入验证码"></BInput>
                    </BFormItem>
                    <BFormActionItem EnableAlwaysRender="true" Style="text-align-last:right;">
                        <BButton Type="@ButtonType.Default" IsPlain="true" OnClick="e => CheckVerifyCode()" EnableAlwaysRender="true">
                            确定
                        </BButton>
                    </BFormActionItem>
                }
            </BForm>
        }
    </Body>
</BCard>